package com.yh.dp.principle.ocp;

/**
 * @ClassName OffNovelBook
 * @Description 打折书籍具体类
 * @Author 0715-YuHao
 * @Date 2021/1/2 15:22
 */
public class OffNovelBook extends NovelBook {

    public OffNovelBook() {
    }

    public OffNovelBook(String name, int price, String author) {
        super(name, price, author);
    }

    @Override
    public int getPrice() {
        int selPrice = super.getPrice();
        int offprice = 0;
        if (selPrice > 7000) {
            offprice = selPrice * 90 / 100;
        }else {
            offprice = selPrice * 80 / 100;
        }
        return offprice;
    }
}
